package edu.java.homework.hw11.join.solution.actors;

import edu.java.homework.hw11.join.solution.dish.Dish;

public class Cook extends Thread {
	Dish dish = null;

	// --- Constructors, Getters/Setters ---------------------------------------

	public Cook(String name, Dish dish) {
		this.dish = dish;
	}

	// --- Methods -------------------------------------------------------------
	@Override
	public void run() {
		System.out.println(Thread.currentThread().getName() + " starts...");
		synchronized (dish) {
			prepareDish();
			putDish();
		}

	}

	public void prepareDish() {
		System.out.println(Thread.currentThread().getName() + " prepare the"
				+ dish.getName());
	}

	public void putDish() {
		System.out.println(Thread.currentThread().getName() + " put the"
				+ dish.getName() + " in the plate.");
	}

}
